<?php

namespace App\Http\Requests\Common\EntityData\Video;

use App\Http\Requests\Request;

class DirectorRequest extends Request
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        switch ($this->method()) {
            case 'GET':
            case 'DELETE':
                {
                    return [];
                }
            // Crate
            case 'POST':
                {
                    return [
                        'name'       => 'required|max:100',
                        'title'      => 'max:100',
                        'subtitle'   => 'max:100',
                        // 'avatar'     => 'max:200',
                        'nickname'   => 'max:100',
                        'english'    => 'max:100',
                        'gender'     => 'max:10',
                        'spell'      => 'max:100',
                        'short_desc' => 'required|max:100',
                        'birthday'   => 'date',
                        'height'     => 'numeric',
                        'weight'     => 'numeric',
                        'area'       => 'max:100',
                    ];
                }
            // UPDATE
            case 'PUT':
            case 'PATCH':
                {
                    // $id = $this->route('directors');
                    return [
                        'name'       => 'required|max:100',
                        'title'      => 'max:100',
                        'subtitle'   => 'max:100',
                        // 'avatar'     => 'max:200',
                        'nickname'   => 'max:100',
                        'english'    => 'max:100',
                        'gender'     => 'max:10',
                        'spell'      => 'max:100',
                        'short_desc' => 'required|max:100',
                        'birthday'   => 'date',
                        'height'     => 'numeric',
                        'weight'     => 'numeric',
                        'area'       => 'max:100',
                    ];
                }
            default:
                break;
        }
    }
     public function messages()
    {
        return [
            'name.required'       => '名称 不能为空',
            'title.max'           => '标题 不能大于 :100',
            'subtitle.required'   => '副标题 不能为空',
            'short_desc.required' => '简介 不能为空',
            'nickname.max'        => '呢称 不能大于 :100',
            'english.max'         => '英文名字 不能大于 :100',
            'gender.max'          => '性别 不能大于 :10',
            'spell.max'           => '拼音 不能大于 :100',
            'birthday.date'       => '出生日期 不是一个有效的日期',
            'height.numeric'      => '身高 必须是一个数字',
            'weight.numeric'      => '体重 必须是一个数字',
            'area.max'            => '区域 不能大于 :100',
            // 'listorder.request'   => '排序',
        ];
    }
}
